import requests
import re


def print_one_page(i, h2_list :list):
    print("打印第{}页".format(i))
    for h2 in h2_list:
        print(h2)
    print('*' * 50)


for i in range(1, 11):
    URL = "https://ssr1.scrape.center/page/{}".format(i)
    response = requests.get(URL)
    text = response.text
    pattern = re.compile('<h2.*?>(.*?)</h2>', re.S)
    h2_list = re.findall(pattern, text)
    print_one_page(i, h2_list)

